﻿using System;

namespace Itau.IM.Common.Mainframe.Book
{
    [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
    public sealed class BookBooleanFieldAttribute : BookFieldBaseAttribute
    {
        public string TrueValue { get; set; }
        public string FalseValue { get; set; }

        public BookBooleanFieldAttribute(int StartIndex, string TrueValue, string FalseValue) : base(StartIndex)
        {
            if (TrueValue == null || FalseValue == null || TrueValue.Length != FalseValue.Length)
            {
                throw new ArgumentException(string.Format("{0}: TrueValue e FalseValue não podem ser nulos e devem possuir o mesmo Length.", this.GetType().Name));
            }
            this.TrueValue = TrueValue;
            this.FalseValue = FalseValue;
        }

        public BookBooleanFieldAttribute() : base(0) { }
    }
}
